package com.tanhua.server.controller;


import com.tanhua.server.service.TestSoulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/testSoul")
public class TestSoulController {
    @Autowired
    private TestSoulService testSoulService;

    @GetMapping(name = "测灵魂-问卷列表")
    public ResponseEntity testSoul() {
        return testSoulService.testSoulList();
    }

    @GetMapping(value = "/report/{id}",name = "测灵魂-查看结果")
    public ResponseEntity testSoulReport(@PathVariable("id") String reportId) {
        return testSoulService.testSoulListReport(reportId);
    }

    @PostMapping(name = "测灵魂-提交问卷")
    public ResponseEntity submitTest(@RequestBody Map answers) {
        List<Object> list = (List<Object>) answers.get("answers");

        return testSoulService.submitTest(list);
    }

}
